#ifndef FILECONFIG_H_
#define FILECONFIG_H_


#define END_PARAM "[end]"
#define INIT_COLOR "[Color]"
#define INIT_ROBOT "[Robot]"
#define INIT_DRIVER "driver\n(\n"
#define INIT_AREAS "[Area]"
/*
#define INIT_PREFILTER "<prefilter>"
#define INIT_POSFILTER "<posfilter>"
#define INIT_THRESHOLDS "[Thresholds]"
*/
#include <stdio.h>
#include "nxColor.h"
#include "Configuration/RobotProject.h"
class ConfigFile
{
	private:
		char* fileName;
		char* filePath;	
		FILE* file;
		
	public:
		ConfigFile(char* fileName, char* filePath, bool read);
		~ConfigFile();
		
		
		bool readConfigFile();
		
		/**
		 * Color will be saved in RGB_CODE
		 */
		bool writeColors(nxColor** colorList, int colorListIndex);
		bool writeAreas(int minArea, int maxArea);
		bool writeRobots(RobotProject* rp);
		bool writeDriverCamera(int cameraIndex, int width, int height);
		bool writeDriverBlobfinder(char* colorFile);
		bool writeDriverRobotPos(Robot* robot,int index, double* matrix, float* distParams, float* intrinsicParams);
		
		bool writeObstConfig(nxColor* color,double* matrix, float* distParams, float* intrinsicParams,int minArea, int maxArea);
		/*
		bool writeSmoothFilter(bool isPreFilter,int smoothType,double smoothParams[]);
		bool writeErodeFilter(bool isPreFilter,int iterations);
		bool writeBckGndFilter(bool isPreFilter,int params[]);
		bool writeThresholds(vcColor** colorList, int colorListIndex);
		*/
		//WEsta funcion no deberia ir aqui, debe ir en protected
		bool readColorId();

		bool writePoints(CvPoint* imagePoints, CvPoint2D32f* realPoints);

	protected:
			
		
		bool writeString(char* string);
		bool writeDouble(double value);
		bool writeInt(int value);
		bool readDouble(double *value);
		bool readInt(int* value);
		bool readString(char* string);
		bool flush();
		bool close();
		bool writeCRLF();
		bool writeTAB();
		


		
		 
};
#endif /*FILECONFIG_H_*/
